//
// Created by YeMingMing on 2024-03-07.
//
// 互满数

#include <stdio.h>

int factor(int x) {
    int result = 0;
    for (int i = 1; i < x;i++) {
        if (x%i == 0) {
            result += i;
        }
    }
    return result;
}



int main() {
    int memo[30000] = {0};
    for (int i = 1;i<30000;i++) {
        if (memo[i] != 0) continue;
        int result1 = factor(i);
        int restlt2 = factor(result1);
        if (restlt2 == i) {
            printf("%d %d\n",i,result1);
            memo[result1] = 1;
        }

    }
    return 0;
}